<?php

namespace App\Jobs;

use App\Services\WxCardService;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

/**
 * 更新单个会员数据
 * @package App\Jobs
 */
class WxCardUpsetOneMember implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $cardId;//会员卡ID
    protected $userCode;//用户会员卡编号

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($cardId, $userCode)
    {
        $this->cardId = $cardId;
        $this->userCode = $userCode;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(WxCardService $wxCardService)
    {
        $wxCardService->createCardObj(WxCardService::CARD_TYPE_MEMBER_CARD)->upsetUserinfo($this->cardId, $this->userCode);
    }
}
